<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="/css/adminMenu.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" language="javascript" src="/js/jquery-1.6.1.min.js"></script>
	<script type="text/javascript" language="javascript" src="/js/ajaxfileupload.js"></script>
	<script type="text/javascript" language="javascript" src="/js/tool.js"></script>
	<title>琥珀川 - 管理电影列表</title>
	<style type="text/css">
		/*标题Font*/
		.tableTitleFont{
			padding-left:5px;
			color:white;
			font-size:14px;
			white-space:nowrap;
		}
		/*选项Font*/
		.itemFont{
			color:#666;
			font-size:12px;
			white-space:nowrap;
		}
		/*重复Font*/
		.repeatFont{
			color:green;
			font-weight:bold;
			font-size:12px;
			white-space:nowrap;
		}
		/*选项A*/
		.itemA{
			color:#09F;
			text-decoration:none;
			font-size:12px;
			white-space:nowrap;
		}
		input{
			margin:0px;
		}
		/*资源类型图标Div*/
		.sourceTypeLogoDiv{
			width:20px;
			height:20px;
			background-repeat:no-repeat;
			background-image:url(/image/system/sourceTypeLogo.png);
		}
	</style>
</head>

<body>
	<jsp:include page="/admin/include/menu" flush="true"/>
	<%--隐藏用于做联动效果的资源类型 的相关数据--%>
	<c:forEach items="${sourceTypeList}" var="aSourceType">
		<input id="sourceTypeLogoPositionY_${aSourceType.id}" type="hidden" value="${aSourceType.logoPositionY}"/>
		<input id="sourceTypeAdDuration_${aSourceType.id}" type="hidden" value="${aSourceType.adDuration}"/>
	</c:forEach>
	<form id="searchForm" action="/admin/movieList" method="get">
		<div class="mainDiv">
			<div>
				<table border="1">
					<tr>
						<td>
							<font>搜索:</font>
						</td>
						<td>
							<select id="searchType" name="searchType" onchange="submitSearchForm()">
								<option value="" <c:if test="${searchType==''}">selected="selected"</c:if>>电影</option>
								<option value="director" <c:if test="${searchType=='director'}">selected="selected"</c:if>>导演</option>
								<option value="actor" <c:if test="${searchType=='actor'}">selected="selected"</c:if>>演员</option>
								<option value="role" <c:if test="${searchType=='role'}">selected="selected"</c:if>>角色</option>
							</select>
							<input id="searchKey" name="searchKey" type="text" value="${searchKey}"/>
							<A class="itemA" href="javascript:submitSearchForm()">[搜索]</A>
							<A class="itemA" href="javascript:clickClearSearchKey()">[清除]</A>
							<%--变红的关键字--%>
							<c:set var="redSearchKey" value="<font style='color:red;'>${searchKey}</font>"></c:set>
						</td>
						<td>
							<font>类型:</font>
						</td>
						<td>
							<select id="typeId" name="typeId" onchange="submitSearchForm()">
								<option value="0" <c:if test="${typeId==0}">selected="selected"</c:if>>全部</option>
								<c:forEach items="${typeList}" var="aType">
									<option value="${aType.id}" <c:if test="${aType.id==typeId}">selected="selected"</c:if>>${aType.name}</option>
								</c:forEach>
							</select>
						</td>
						<td>
							<font>地区:</font>
						</td>
						<td>
							<select id="areaSortId" name="areaSortId" onchange="changeAreaSortId()">
								<option value="0" <c:if test="${areaSortId==0}">selected="selected"</c:if>>全部</option>
								<c:forEach items="${areaSortList}" var="aAreaSort">
									<option value="${aAreaSort.id}" <c:if test="${aAreaSort.id==areaSortId}">selected="selected"</c:if>>${aAreaSort.name}</option>
								</c:forEach>
							</select>
							<c:if test="${areaSortId!=0}">
								<select id="areaId" name="areaId" onchange="submitSearchForm()">
									<option value="0" <c:if test="${areaId==0}">selected="selected"</c:if>>全部</option>
									<c:forEach items="${areaList}" var="aArea">
										<option value="${aArea.id}" <c:if test="${aArea.id==areaId}">selected="selected"</c:if>>${aArea.name}</option>
									</c:forEach>
								</select>
							</c:if>
						</td>
						<td>
							<font>操作:</font>
						</td>
						<td>
							<input id="state" name="state" type="hidden" value="${state}"/>
							<c:choose>  
								<c:when test="${state == 'edit'}">
									<A class="itemA" href="javascript:clickSave()">[保存]</A>
									<A class="itemA" href="javascript:clickCancelEdit()">[取消编辑]</A>
								</c:when>
								<c:otherwise>
									<A class="itemA" href="javascript:clickEdit()">[编辑]</A>
								</c:otherwise>
							</c:choose>
							<A class="itemA" href="javascript:clickDeleteSelectMovie()">[删除选中]</A>
						</td>
					</tr>
				</table>
			</div>
			<div>
				<table border="1">
					<tr>
						<td>
							<font>显示:</font>
						</td>
						<td>
							<select id="showRow" name="showRow" onchange="submitSearchForm()">
								<option value="" <c:if test="${showRow==''}">selected="selected"</c:if>>全部</option>
								<option value="not" <c:if test="${showRow=='not'}">selected="selected"</c:if>>缺少</option>
								<option value="notLogo" <c:if test="${showRow=='notLogo'}">selected="selected"</c:if>>缺少海报</option>
								<option value="notBaike" <c:if test="${showRow=='notBaike'}">selected="selected"</c:if>>缺少百科</option>
								<option value="notArea" <c:if test="${showRow=='notArea'}">selected="selected"</c:if>>缺少地区</option>
								<option value="notDirector" <c:if test="${showRow=='notDirector'}">selected="selected"</c:if>>缺少导演</option>
								<option value="notSummary" <c:if test="${showRow=='notSummary'}">selected="selected"</c:if>>缺少简介</option>
								<option value="notReleaseDate" <c:if test="${showRow=='notReleaseDate'}">selected="selected"</c:if>>缺少上映时间</option>
							</select>
						</td>
						<td>
							<%--显示电影海报--%>
							<input id="showLogo" onclick="changeShowState()" type="checkbox" 
								<c:if test="${showCol.showLogo}">checked</c:if> 
							/><font class="itemFont">电影海报</font>
							<%--显示电影名--%>
							<input id="showName" onclick="changeShowState()" type="checkbox" 
								<c:if test="${showCol.showName}">checked</c:if> 
							/><font class="itemFont">电影名</font>
						</td>
						<td>
							<div>
								<input type="radio" id="showBaikeInfo" name="showMain" onclick="changeShowState()" 
									<c:if test="${showCol.showBaikeInfo}">checked</c:if> 
								/>
								<%--显示百科--%>
								<input id="showBaike" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showBaike}">checked</c:if>
									<c:if test="${showCol.showBaikeInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">百科</font>
								<%--显示地区--%>
								<input id="showArea" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showArea}">checked</c:if>
									<c:if test="${showCol.showBaikeInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">地区</font>
								<%--显示类型--%>
								<input id="showType" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showType}">checked</c:if>
									<c:if test="${showCol.showBaikeInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">类型</font>
								<%--显示类型数量--%>
								<input id="showTypeCount" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showTypeCount}">checked</c:if>
									<c:if test="${showCol.showBaikeInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">类型数量</font>
							</div>
							<div>
								<input type="radio" id="showDirectorInfo" name="showMain" onclick="changeShowState()" 
									<c:if test="${showCol.showDirectorInfo}">checked</c:if> 
								/>
								<%--显示导演--%>
								<input id="showDirector" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showDirector}">checked</c:if>
									<c:if test="${showCol.showDirectorInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">导演</font>
								<%--显示演员--%>
								<input id="showActor" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showActor}">checked</c:if>
									<c:if test="${showCol.showDirectorInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">演员</font>
								<%--显示演员数量--%>
								<input id="showActorCount" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showActorCount}">checked</c:if>
									<c:if test="${showCol.showDirectorInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">演员数量</font>
							</div>
							<div>
								<input type="radio" id="showSummaryInfo" name="showMain" onclick="changeShowState()" 
									<c:if test="${showCol.showSummaryInfo}">checked</c:if> 
								/>
								<%--显示简介--%>
								<input id="showSummary" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showSummary}">checked</c:if>
									<c:if test="${showCol.showSummaryInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">简介</font>
								<%--显示上映时间--%>
								<input id="showReleaseDate" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showReleaseDate}">checked</c:if>
									<c:if test="${showCol.showSummaryInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">上映时间</font>
							</div>
							<div>
								<input type="radio" id="showSourceInfo" name="showMain" onclick="changeShowState()" 
									<c:if test="${showCol.showSourceInfo}">checked</c:if> 
								/>
								<%--显示资源--%>
								<input id="showSource" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showSource}">checked</c:if>
									<c:if test="${showCol.showSourceInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">资源</font>
								<%--显示资源数量--%>
								<input id="showSourceCount" onclick="changeShowState()" type="checkbox"
									<c:if test="${showCol.showSourceCount}">checked</c:if>
									<c:if test="${showCol.showSourceInfo == false}">disabled="disabled"</c:if>
								/><font class="itemFont">资源数量</font>
							</div>
						</td>
						<td>
							<%--显示权重--%>
							<input id="showWeight" onclick="changeShowState()" type="checkbox" 
								<c:if test="${showCol.showWeight}">checked</c:if> 
							/><font class="itemFont">权重</font>
						</td>
						<td>
							<div>
								<%--显示创建时间--%>
								<input id="showCreateTime" name="showTime" onclick="changeShowState()" type="radio" 
									<c:if test="${showCol.showCreateTime}">checked</c:if> 
								/><font class="itemFont">创建时间</font>
							</div>
							<div>
								<%--显示更新时间--%>
								<input id="showUpdateTime" name="showTime" onclick="changeShowState()" type="radio" 
									<c:if test="${showCol.showUpdateTime}">checked</c:if> 
								/><font class="itemFont">更新时间</font>
							</div>
						</td>
						<td>
							<font>排序:</font>
						</td>
						<td>
							<select id="order" onchange="changeShowState()">
								<option value="id" <c:if test="${order=='id'}">selected="selected"</c:if>>id</option>
								<option value="name" <c:if test="${order=='name'}">selected="selected"</c:if>>电影名</option>
								<option value="byname" <c:if test="${order=='byname'}">selected="selected"</c:if>>别名</option>
								<option value="typeCount" <c:if test="${order=='typeCount'}">selected="selected"</c:if>>类型数量</option>
								<option value="actorCount" <c:if test="${order=='actorCount'}">selected="selected"</c:if>>演员数量</option>
								<option value="sourceCount" <c:if test="${order=='sourceCount'}">selected="selected"</c:if>>资源数量</option>
								<option value="releaseDate" <c:if test="${order=='releaseDate'}">selected="selected"</c:if>>上映时间</option>
								<option value="weight" <c:if test="${order=='weight'}">selected="selected"</c:if>>权重</option>
								<option value="createTime" <c:if test="${order=='createTime'}">selected="selected"</c:if>>创建时间</option>
								<option value="updateTime" <c:if test="${order=='updateTime'}">selected="selected"</c:if>>更新时间</option>
							</select>
							<input id="asc" onclick="changeShowState()" type="checkbox" <c:if test="${asc}">checked</c:if> />升序
						</td>
					</tr>
				</table>
			</div>
			<div>
				<table style="border:1px solid black;" border="0" width="100%">
					<tr style="background-color:#09F; color:white;">
						<td><input id="selectAll" type="checkbox" onclick="clickSelectAll()"/></td>
						<td align="center">
							<font class="tableTitleFont">no</font>
						</td>
						<td align="center">
							<font class="tableTitleFont">id</font>
						</td>
						<c:if test="${showCol.showLogo}"> 
							<td align="center">
								<font class="tableTitleFont">电影海报</font>
							</td>
						</c:if>
						<c:if test="${showCol.showName}">
							<td align="center">
								<font class="tableTitleFont">电影名/别名</font>
							</td>
						</c:if>
						
						<c:if test="${showCol.showBaikeInfo}">
							<c:if test="${showCol.showBaike}">
								<td>
									<font class="tableTitleFont">百科</font>
								</td>
							</c:if>
							<c:if test="${showCol.showArea}">
								<td align="center">
									<font class="tableTitleFont">地区</font>
								</td>
							</c:if>
							<c:if test="${showCol.showType}">
								<td>
									<font class="tableTitleFont">类型</font>
								</td>
							</c:if>
							<c:if test="${showCol.showTypeCount}">
								<td align="center">
									<font class="tableTitleFont">数量</font>
								</td>
							</c:if>
						</c:if>
						
						<c:if test="${showCol.showDirectorInfo}">
							<c:if test="${showCol.showDirector}">
								<td align="center">
									<font class="tableTitleFont">导演</font>
								</td>
							</c:if>
							<c:if test="${showCol.showActor}">
								<td>
									<font class="tableTitleFont">演员</font>
								</td>
							</c:if>
							<c:if test="${showCol.showActorCount}">
								<td align="center">
									<font class="tableTitleFont">数量</font>
								</td>
							</c:if>
						</c:if>
						
						<c:if test="${showCol.showSummaryInfo}">
							<c:if test="${showCol.showSummary}">
								<td>
									<font class="tableTitleFont">简介</font>
								</td>
							</c:if>
							<c:if test="${showCol.showReleaseDate}">
								<td align="center">
									<font class="tableTitleFont">上映</font>
								</td>
							</c:if>
						</c:if>
						
						<c:if test="${showCol.showSourceInfo}">
							<c:if test="${showCol.showSource}">
								<td>
									<font class="tableTitleFont">资源</font>
								</td>
							</c:if>
							<c:if test="${showCol.showSourceCount}">
								<td align="center">
									<font class="tableTitleFont">数量</font>
								</td>
							</c:if>
						</c:if>
						
						<c:if test="${showCol.showWeight}">
							<td align="center">
								<font class="tableTitleFont">权重</font>
							</td>
						</c:if>
						<c:if test="${showCol.showCreateTime}">
							<td align="center">
								<font class="tableTitleFont">创建</font>
							</td>
						</c:if>
						<c:if test="${showCol.showUpdateTime}">
							<td align="center">
								<font class="tableTitleFont">更新</font>
							</td>
						</c:if>
						<td align="center">
							<font class="tableTitleFont">操作</font>
						</td>
					</tr>
					<c:forEach items="${movieList}" varStatus="status" var="aMovie">
						<tr
							<c:choose>
								<c:when test="${status.index % 2 == 0}">style="background-color:#FCC;"</c:when>
								<c:otherwise>style="background-color:#FFC;"</c:otherwise>
							</c:choose> 
						>
							<td align="center">
								<input id="select_${status.index}" type="checkbox" />
							</td>
							<td align="center">
								${status.index+1}
							</td>
							<td align="center">
								${aMovie.id}
								<input id="id_${status.index}" type="hidden" value="${aMovie.id}"/>
							</td>
							
							<%--显示电影海报--%>
							<c:if test="${showCol.showLogo}">
								<td align="center">
									<div style="width:134px; border:1px solid black; height:178px; overflow:hidden;">
										<img id="logoImg_${status.index}" 
											<c:choose>  
												<c:when test="${aMovie.logoPath == ''}">
													src="/image/system/defaultMovieLogo.png"
												</c:when>
												<c:otherwise> 
													src="${aMovie.logoPath}"
												</c:otherwise>
											</c:choose>
										style="border:0px; width:134px;"/>
									</div>
									<%--判断是否为编辑模式--%>
									<c:if test="${state == 'edit'}">
										<div>
											<input id="tempImgName_${status.index}" type="hidden" />
											<input id="logoFile_${status.index}" name="logoFile_${status.index}" type="file" onchange="changeLogoPath(${status.index})" style="width:68px;" />
										</div>
									</c:if>
								</td>
							</c:if>
							
							<%--显示电影名--%>
							<c:if test="${showCol.showName}"> 
								<td align="center">
									<%--判断是否为编辑模式--%>
									<c:choose>  
										<c:when test="${state == 'edit'}">
											<div>
												<input id="name_${status.index}" type="text" value="${aMovie.name}" style="width:100px;" />
											</div>
											<div>
												<input id="byname_${status.index}" type="text" value="${aMovie.byname}" style="width:100px;" />
											</div>
											<div>
												<A href="/movie/${aMovie.id}" class="itemA" target="_blank" title="/movie/${aMovie.id}">[查看]</A>
											</div>
										</c:when>
										<c:otherwise>
											<div>
												<A href="/movie/${aMovie.id}" class="itemA" target="_blank" title="/movie/${aMovie.id}">
													<%--判断是否需要本列关键字变红--%>
													<c:choose>  
														<c:when test="${searchType==''}">
															${fn:replace(aMovie.name,searchKey,redSearchKey)}
														</c:when>
														<c:otherwise>
															${aMovie.name}
														</c:otherwise>
													</c:choose>
												</A>
											</div>
											<div>
												<font class="itemFont">
													<%--判断是否需要本列关键字变红--%>
													<c:choose>  
														<c:when test="${searchType==''}">
															${fn:replace(aMovie.byname,searchKey,redSearchKey)}
														</c:when>
														<c:otherwise>
															${aMovie.byname}
														</c:otherwise>
													</c:choose>
												</font>
											</div>
										</c:otherwise>
									</c:choose>
								</td>
							</c:if>
							
							<%--显示百科信息--%>
							<c:if test="${showCol.showBaikeInfo}">
								<%--显示百科--%>
								<c:if test="${showCol.showBaike}">
									<td>
										<%--判断是否为编辑模式--%>
										<c:choose>  
											<c:when test="${state == 'edit'}">
												<div>
													<input id="baikeUrl_${status.index}" type="text" value="${aMovie.baikeUrl}" style="width:95%;"/>
												</div>
												<div>
													<A href="http://baike.baidu.com/search?word=${aMovie.name}" class="itemA" target="_blank" title="http://baike.baidu.com/search?word=${aMovie.name}">[搜索]</A>
													<c:if test="${aMovie.baikeUrl !=''}">
														<A href="${aMovie.baikeUrl}" class="itemA" target="_blank" title="${aMovie.baikeUrl}">[查看]</A>
													</c:if>
												</div>
											</c:when>
											<c:otherwise>
												<A href="${aMovie.baikeUrl}" title="${aMovie.baikeUrl}" class="itemA" target="_blank">${aMovie.baikeUrl}</A>
											</c:otherwise>
										</c:choose>
									</td>
								</c:if>
								<%--显示地区--%>
								<c:if test="${showCol.showArea}">
									<td align="center">
										<%--判断是否为编辑模式--%>
										<c:choose>  
											<c:when test="${state == 'edit'}">
												<input id="area_${status.index}" type="text" value="${aMovie.areaName}" style="width:30px;"/>
											</c:when>
											<c:otherwise>
												<font class="itemFont">${aMovie.areaName}</font>
											</c:otherwise>
										</c:choose>
									</td>
								</c:if>
								<%--显示类型--%>
								<c:if test="${showCol.showType}">
									<td>
										<div style="max-height:200px; border:1px solid black; overflow-y:auto;">
											<%--子集表格--%>
											<table border="1">
												<c:forEach items="${aMovie.movieTypeList}" varStatus="typeStatus" var="aMovieType">
													<tr>
														<td>${typeStatus.index}</td>
														<td>
															${aMovieType.id}
															<input id="movieTypeId_${status.index}_${typeStatus.index}" type="hidden" value="${aMovieType.id}"/>
														</td>
														<%--类型名称--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<select id="typeId_${status.index}_${typeStatus.index}">
																		<c:forEach items="${typeList}" var="aType">
																			<option value="${aType.id}" <c:if test="${aType.id==aMovieType.typeId}">selected="selected"</c:if>>${aType.name}</option>
																		</c:forEach>
																	</select>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieType.typeName}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--类型权重--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="typeWeight_${status.index}_${typeStatus.index}" type="text" value="${aMovieType.weight}" style="width:30px;"/>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieType.weight}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--类型创建时间--%>
														<td>
															<font class="itemFont" title="${aMovieType.createTime}">${aMovieType.createTimeString}</font>
														</td>
														<%--类型更新时间--%>
														<td>
															<font class="itemFont" title="${aMovieType.updateTime}">${aMovieType.updateTimeString}</font>
														</td>
														<%--类型权重--%>
														<td>
															<A href="javascript:clickDeleteMovieType(${aMovieType.id})" class="itemA">[删除]</A>
														</td>
													</tr>
												</c:forEach>
												<%--添加类型--%>
												<c:if test="${state == 'edit'}">
													<tr>
														<td></td>
														<td></td>
														<%--添加类型ID--%>
														<td>
															<select id="addTypeId_${status.index}">
																<c:forEach items="${typeList}" var="aType">
																	<%--判断是否存在的此类型--%>
																	<c:set var="typeNotExist" value="false"/>
																	<c:forEach items="${aMovie.movieTypeList}" var="aMovieType">
																		<c:if test="${aType.id==aMovieType.typeId}">
																			<c:set var="typeNotExist" value="true"/>
																		</c:if>
																	</c:forEach>
																	<c:if test="${typeNotExist == 'false'}">
																		<option value="${aType.id}">${aType.name}</option>
																	</c:if>
																</c:forEach>
															</select>
														</td>
														<%--添加类型权重--%>
														<td>
															<input id="addTypeWeight_${status.index}" type="text" style="width:30px;" />
														</td>
														<td></td>
														<td></td>
														<td>
															<A href="javascript:clickAddMovieType(${status.index})" class="itemA">[新增]</A>
														</td>
													</tr>
												</c:if>
											</table>
											<%--隐藏的类型数量用于计算JS循环其取值次数--%>
											<input id="typeCount_${status.index}" type="hidden" value="${aMovie.typeCount}"/>
										</div>
									</td>
								</c:if>
								<c:if test="${showCol.showTypeCount}">
									<td align="center">
										<font class="itemFont">${aMovie.typeCount}</font>
									</td>
								</c:if>
							</c:if>
							
							<%--显示导演信息--%>
							<c:if test="${showCol.showDirectorInfo}">
								<%--显示导演--%>
								<c:if test="${showCol.showDirector}">
									<td align="center">
										<%--判断是否为编辑模式--%>
										<c:choose>  
											<c:when test="${state == 'edit'}">
												<input id="director_${status.index}" type="text" value="${aMovie.directorName}" style="width:100px;"/>
											</c:when>
											<c:otherwise>
												<A href="/movieList?directorId=${aMovie.directorId}" 
													title="/movieList?directorId=${aMovie.directorId}" 
													class="itemA" target="_blank"
												>
													<%--判断是否需要本列关键字变红--%>
													<c:choose> 
														<c:when test="${searchType=='director'}">
															${fn:replace(aMovie.directorName,searchKey,redSearchKey)}
														</c:when>
														<c:otherwise>
															${aMovie.directorName}
														</c:otherwise>
													</c:choose>
												</A>
											</c:otherwise>
										</c:choose>
									</td>
								</c:if>
								<%--显示演员--%>
								<c:if test="${showCol.showActor}">
									<td>
										<div style="max-height:200px; border:1px solid black; overflow-y:auto;">
											<%--子集表格--%>
											<table border="1">
												<c:forEach items="${aMovie.movieActorList}"  varStatus="actorStatus" var="aMovieActor">
													<tr>
														<td>${actorStatus.index}</td>
														<td>
															${aMovieActor.id}
															<input id="movieActorId_${status.index}_${actorStatus.index}" type="hidden" value="${aMovieActor.id}"/>
														</td>
														<%--演员名称--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="actorName_${status.index}_${actorStatus.index}" type="text" value="${aMovieActor.actorName}" style="width:100px;"/>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">
																		<%--判断是否需要本列关键字变红--%>
																		<c:choose>  
																			<c:when test="${searchType=='actor'}">
																				${fn:replace(aMovieActor.actorName,searchKey,redSearchKey)}
																			</c:when>
																			<c:otherwise>
																				${aMovieActor.actorName}
																			</c:otherwise>
																		</c:choose>
																	</font>
																</c:otherwise>
															</c:choose>
														</td>
														<td>
															<font class="itemFont">饰</font>
														</td>
														<%--演员饰演角色名称--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="roleName_${status.index}_${actorStatus.index}" type="text" value="${aMovieActor.roleName}" style="width:100px;"/>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">
																		<%--判断是否需要本列关键字变红--%>
																		<c:choose>  
																			<c:when test="${searchType=='role'}">
																				${fn:replace(aMovieActor.roleName,searchKey,redSearchKey)}
																			</c:when>
																			<c:otherwise>
																				${aMovieActor.roleName}
																			</c:otherwise>
																		</c:choose>
																	</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--演员权重--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="roleWeight_${status.index}_${actorStatus.index}" type="text" value="${aMovieActor.weight}" style="width:30px;"/>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieActor.weight}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--演员创建时间--%>
														<td>
															<font class="itemFont" title="${aMovieActor.createTime}">${aMovieActor.createTimeString}</font>
														</td>
														<%--演员更新时间时间--%>
														<td>
															<font class="itemFont" title="${aMovieActor.updateTime}">${aMovieActor.updateTimeString}</font>
														</td>
														<%--演员操作--%>
														<td>
															<A href="javascript:clickDeleteMovieActor(${aMovieActor.id})" class="itemA">[删除]</A>
														</td>
													</tr>
												</c:forEach>
												<%--添加演员--%>
												<c:if test="${state == 'edit'}">
													<tr>
														<td></td>
														<td></td>
														<%--添加演员名称--%>
														<td>
															<input id="addActorName_${status.index}" type="text" style="width:100px;" />
														</td>
														<td>
															<font class="itemFont">饰</font>
														</td>
														<%--添加演员角色名称--%>
														<td>
															<input id="addRoleName_${status.index}" type="text" style="width:100px;" />
														</td>
														<%--添加演员权重--%>
														<td>
															<input id="addRoleWeight_${status.index}" type="text" style="width:30px;" />
														</td>
														<td></td>
														<td></td>
														<td>
															<A href="javascript:clickAddMovieActor(${status.index})" class="itemA">[新增]</A>
														</td>
													</tr>
												</c:if>
											</table>
											<%--隐藏的演员数量用于计算JS循环其取值次数--%>
											<input id="actorCount_${status.index}" type="hidden" value="${aMovie.actorCount}"/>
										</div>
									</td>
								</c:if>
								<%--显示演员数量--%>
								<c:if test="${showCol.showActorCount}">
									<td align="center">
										<font class="itemFont">${aMovie.actorCount}</font>
									</td>
								</c:if>
							</c:if>
							
							<%--显示简介信息--%>
							<c:if test="${showCol.showSummaryInfo}">
								<%--显示简介--%>
								<c:if test="${showCol.showSummary}">
									<td>
										<%--判断是否为编辑模式--%>
										<c:choose>  
											<c:when test="${state == 'edit'}">
												<textarea id="summary_${status.index}" style="width:95%; height:200px;">${aMovie.summary}</textarea>
											</c:when>
											<c:otherwise>
												<div style="width:95%; max-height:200px; border:1px solid black; overflow-y:scroll;">
													<% request.setAttribute("vEnter","\n"); %>
													<c:set var="summaryList" value="${fn:split(aMovie.summary,vEnter)}" />
													<c:forEach items="${summaryList}" var="aSummary">
														<div style="line-height:25px; font-size:14px; color:#666; text-indent:2em; margin-bottom:10px;">
															${aSummary}
														</div>
													</c:forEach>
												</div>
											</c:otherwise>
										</c:choose>
									</td>
								</c:if>
								<%--显示上映时间--%>
								<c:if test="${showCol.showReleaseDate}">
									<td align="center">
										<%--判断是否为编辑模式--%>
										<c:choose>  
											<c:when test="${state == 'edit'}">
												<input id="releaseDate_${status.index}" type="text" value="${aMovie.releaseDate}" style="width:100px;"/>
											</c:when>
											<c:otherwise>
												<font class="itemFont">${aMovie.releaseDate}</font>
											</c:otherwise>
										</c:choose>
									</td>
								</c:if>
							</c:if>
							<%--显示资源信息--%>
							<c:if test="${showCol.showSourceInfo}">	
								<%--显示资源--%>
								<c:if test="${showCol.showSource}">
									<td>
										<div style="max-height:200px; border:1px solid black; overflow-y:auto;">
											<%--子集表格--%>
											<table border="1">
												<c:forEach items="${aMovie.movieSourceList}"  varStatus="sourceStatus" var="aMovieSource">
													<tr>
														<td>${sourceStatus.index}</td>
														<td>
															${aMovieSource.id}
															<input id="movieSourceId_${status.index}_${sourceStatus.index}" type="hidden" value="${aMovieSource.id}"/>
														</td>
														<%--资源Logo--%>
														<td>
															<div id="sourceTypeLogo_${status.index}_${sourceStatus.index}" class="sourceTypeLogoDiv" style="background-position:0px ${aMovieSource.typeLogoPositionY};"></div>
														</td>
														<%--资源类型--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<select id="sourceTypeId_${status.index}_${sourceStatus.index}" onchange="changeSourceTypeId(${status.index},${sourceStatus.index})">
																		<c:forEach items="${sourceTypeList}" var="aSourceType">
																			<option value="${aSourceType.id}" 
																				<c:if test="${aSourceType.id==aMovieSource.typeId}">selected="selected"</c:if>
																			>${aSourceType.name}</option>
																		</c:forEach>
																	</select>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieSource.typeName}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源语言--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<select id="sourceLanguageId_${status.index}_${sourceStatus.index}">
																		<option value="0" 
																			<c:if test="${aMovieSource.languageId == 0}">selected="selected"</c:if>
																		>请选择</option>
																		<c:forEach items="${sourceLanguageList}" var="aSourceLanguage">
																			<option value="${aSourceLanguage.id}" 
																				<c:if test="${aMovieSource.languageId == aSourceLanguage.id}">selected="selected"</c:if>
																			>${aSourceLanguage.name}</option>
																		</c:forEach>
																	</select>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieSource.languageName}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源字幕--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<select id="sourceSubtitleId_${status.index}_${sourceStatus.index}">
																		<option value="0" 
																			<c:if test="${aMovieSource.subtitleId == 0}">selected="selected"</c:if>
																		>请选择</option>
																		<c:forEach items="${sourceSubtitleList}" var="aSourceSubtitle">
																			<option value="${aSourceSubtitle.id}" 
																				<c:if test="${aMovieSource.subtitleId == aSourceSubtitle.id}">selected="selected"</c:if>
																			>${aSourceSubtitle.name}</option>
																		</c:forEach>
																	</select>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieSource.subtitleName}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源状况--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<select id="sourceModeId_${status.index}_${sourceStatus.index}">
																		<option value="0" 
																			<c:if test="${aMovieSource.modeId == 0}">selected="selected"</c:if>
																		>请选择</option>
																		<c:forEach items="${sourceModeList}" var="aSourceMode">
																			<option value="${aSourceMode.id}" 
																				<c:if test="${aMovieSource.modeId == aSourceMode.id}">selected="selected"</c:if>
																			>${aSourceMode.name}</option>
																		</c:forEach>
																	</select>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieSource.modeName}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源广告时间--%>
														<td>
															<font id="sourceTypeAdDuration_${status.index}_${sourceStatus.index}" class="itemFont">${aMovieSource.typeAdDuration}</font>秒
														</td>
														<%--资源网址--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="sourceUrl_${status.index}_${sourceStatus.index}" type="text" value="${aMovieSource.url}" style="width:100px;"/>
																</c:when>
																<c:otherwise>
																	<A href="${aMovieSource.url}" title="${aMovieSource.url}" class="itemA" target="_blank">${aMovieSource.url}</A>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源权重--%>
														<td>
															<%--判断是否为编辑模式--%>
															<c:choose>  
																<c:when test="${state == 'edit'}">
																	<input id="sourceWeight_${status.index}_${sourceStatus.index}" type="text" value="${aMovieSource.weight}" style="width:30px;"/>
																</c:when>
																<c:otherwise>
																	<font class="itemFont">${aMovieSource.weight}</font>
																</c:otherwise>
															</c:choose>
														</td>
														<%--资源创建时间--%>
														<td>
															<font class="itemFont" title="${aMovieSource.createTime}">${aMovieSource.createTimeString}</font>
														</td>
														<%--资源更新时间--%>
														<td>
															<font class="itemFont" title="${aMovieSource.updateTime}">${aMovieSource.updateTimeString}</font>
														</td>
														<%--资源权重--%>
														<td>
															<A href="javascript:clickDeleteMovieSource(${aMovieSource.id})" class="itemA">[删除]</A>
														</td>
													</tr>
												</c:forEach>
												<%--添加资源--%>
												<c:if test="${state == 'edit'}">
													<tr>
														<td></td>
														<td></td>
														<%--添加资源Logo--%>
														<td>
															<div id="addSourceTypeLogo_${status.index}" class="sourceTypeLogoDiv"></div>
														</td>
														<%--添加资源类型--%>
														<td>
															<select id="addSourceTypeId_${status.index}" onchange="changeAddSourceTypeId(${status.index})">
																<c:forEach items="${sourceTypeList}" var="aSourceType">
																	<%--判断是否存在的此资源类型--%>
																	<c:set var="sourceTypeNotExist" value="false"/>
																	<c:forEach items="${aMovie.movieSourceList}" var="aMovieSource">
																		<c:if test="${aSourceType.id==aMovieSource.typeId}">
																			<c:set var="sourceTypeNotExist" value="true"/>
																		</c:if>
																	</c:forEach>
																	<c:if test="${sourceTypeNotExist == 'false'}">
																		<option value="${aSourceType.id}">${aSourceType.name}</option>
																	</c:if>
																</c:forEach>
															</select>
														</td>
														<%--添加资源语言ID--%>
														<td>
															<select id="addSourceLanguageId_${status.index}">
																<option value="0">请选择</option>
																<c:forEach items="${sourceLanguageList}" var="aSourceLanguage">
																	<option value="${aSourceLanguage.id}">${aSourceLanguage.name}</option>
																</c:forEach>
															</select>
														</td>
														<%--添加资源字幕ID--%>
														<td>
															<select id="addSourceSubtitleId_${status.index}">
																<option value="0">请选择</option>
																<c:forEach items="${sourceSubtitleList}" var="aSourceSubtitle">
																	<option value="${aSourceSubtitle.id}">${aSourceSubtitle.name}</option>
																</c:forEach>
															</select>
														</td>
														<%--添加资源状况ID--%>
														<td>
															<select id="addSourceModeId_${status.index}">
																<option value="0">请选择</option>
																<c:forEach items="${sourceModeList}" var="aSourceMode">
																	<option value="${aSourceMode.id}">${aSourceMode.name}</option>
																</c:forEach>
															</select>
														</td>
														<%--添加资源广告时间--%>
														<td>
															<font id="addSourceTypeAdDuration_${status.index}" class="itemFont"></font>秒
														</td>
														<%--添加资源网址--%>
														<td>
															<input id="addSourceUrl_${status.index}" type="text" style="width:100px;"/>
														</td>
														<%--添加资源权重--%>
														<td>
															<input id="addSourceWeight_${status.index}" type="text" style="width:30px;"/>
														</td>
														<td></td>
														<td></td>
														<td>
															<A href="javascript:clickAddMovieSource(${status.index})" class="itemA">[新增]</A>
														</td>
													</tr>
												</c:if>
											</table>
											<%--判断是否为编辑模式--%>
											<c:if test="${state == 'edit'}">
												<div>
													<font class="itemFont">搜索资源：</font>
													<%--搜索资源网址--%>
													<table>
													<tr>
													<c:forEach items="${sourceTypeList}" var="aSourceType">
														<td>
														<A href="${aSourceType.searchUrl}${aMovie.encodeName}" 
															title="${aSourceType.name}：${aSourceType.searchUrl}${aMovie.encodeName}" 
															class="itemA" target="_blank">
															<div class="sourceTypeLogoDiv" style="background-position:0px ${aSourceType.logoPositionY};"></div>
														</A>
														</td>
													</c:forEach>
													</tr>
													</table>
												</div>
											</c:if>
											<%--隐藏的资源数量用于计算JS循环其取值次数--%>
											<input id="sourceCount_${status.index}" type="hidden" value="${aMovie.sourceCount}"/>
										</div>
									</td>
								</c:if>
								<%--显示资源数量--%>
								<c:if test="${showCol.showSourceCount}">
									<td align="center">
										<font class="itemFont">${aMovie.sourceCount}</font>
									</td>
								</c:if>
							</c:if>
							
							<%--显示权重--%>
							<c:if test="${showCol.showWeight}">
								<td align="center">
									<font class="itemFont">${aMovie.weight}</font>
								</td>
							</c:if>
							
							<%--显示创建时间--%>
							<c:if test="${showCol.showCreateTime}">
								<td align="center">
									<font class="itemFont" title="${aMovie.createTime}">${aMovie.createTimeString}</font>
								</td>
							</c:if>
							
							<%--显示更新时间--%>
							<c:if test="${showCol.showUpdateTime}">
								<td align="center">
									<font class="itemFont" title="${aMovie.updateTime}">${aMovie.updateTimeString}</font>
								</td>
							</c:if>
							
							<td align="center">
								<A href="javascript:clickDeleteMovie(${aMovie.id})" class="itemA">[删除]</A>
							</td>
						</tr>
					</c:forEach>
				</table>
			</div>
			<div>
				<input id="pageNo" name="pageNo" type="hidden" value="${pageNo}" />
				共找到${infoCount}条信息 每页显示
				<select id="pageSize" onchange="changeShowState()">
					<%
						List<Long> pageSizeList = new Vector<Long>();
						pageSizeList.add(new Long(5));
						pageSizeList.add(new Long(10));
						pageSizeList.add(new Long(20));
						pageSizeList.add(new Long(50));
						pageSizeList.add(new Long(100));
						request.setAttribute("pageSizeList",pageSizeList); 
					%>
					<c:forEach items="${pageSizeList}" var="aPageSize">
						<option value="${aPageSize}" <c:if test="${pageSize==aPageSize}">selected="selected"</c:if>>${aPageSize}</option>
					</c:forEach>
				</select>
				条 当前在第${pageNo}/${pageCount}页
				<%--当前不是第一页--%>
				<c:if test="${pageNo != 1}">
					<A class="itemA" href="javascript:clickPageNo(1)">首页</A>
					<A class="itemA" href="javascript:clickPageNo(${pageNo - 1})">上一页</A>
				</c:if>
				<%--当前不是最后一页--%>
				<c:if test="${pageNo != pageCount}">
					<A class="itemA" href="javascript:clickPageNo(${pageNo + 1})">下一页</A>
					<A class="itemA" href="javascript:clickPageNo(${pageCount})">尾页</A>
				</c:if>
			</div>
		</div>
	</form>
</body>
<script type="text/javascript">
	<%--点击清除关键字--%>
	function clickClearSearchKey(){
		$("#searchKey").val("");
		$("#searchForm").submit();
	}
	
	<%--点击页号--%>
	function clickPageNo(no){
		$("#pageNo").val(no);
		$("#searchForm").submit();
	}
	
	<%--改变地区分类ID--%>
	function changeAreaSortId(){
		$("#areaId").val("0");
		$("#searchForm").submit();
	}
	
	<%--提交搜索表单--%>
	function submitSearchForm(){
		$("#searchForm").submit();
	}
	
	<%--提交搜索的Form表单--%>
	$("#searchForm").submit(function(){
		var searchType = $("#searchType").val();
		var searchKey = $("#searchKey").val();
		var typeId = $("#typeId").val();
		var areaSortId = $("#areaSortId").val();
		var areaId = $("#areaId").val();
		var state = $("#state").val();
		var showRow = $("#showRow").val();
		var pageNo = $("#pageNo").val();
		
		if(searchType == ""){
			$("#searchType").removeAttr("name"); 
		}
		
		if(searchKey == ""){
			$("#searchKey").removeAttr("name");
		}
		
		if(typeId == "0"){
			$("#typeId").removeAttr("name");
		}
		
		if(areaSortId == "0"){
			$("#areaSortId").removeAttr("name");
		}
		
		if(areaId == "0"){
			$("#areaId").removeAttr("name");
		}
		
		if(state == ""){
			$("#state").removeAttr("name");
		}
		
		if(showRow == ""){
			$("#showRow").removeAttr("name");
		}
		
		if(pageNo == "1"){
			$("#pageNo").removeAttr("name");
		}
		
		$("#showBaikeInfo").removeAttr("name");
		$("#showDirectorInfo").removeAttr("name");
		$("#showSummaryInfo").removeAttr("name");
		$("#showSourceInfo").removeAttr("name");
		
		$("#showCreateTime").removeAttr("name");
		$("#showUpdateTime").removeAttr("name");
		
		var pageSize = 	parseInt($("#pageSize").val());
		for(var i = 0; i < pageSize ; i++){
			$("#logoFile_" + i).removeAttr("name");
		}
	});
	
	<%--改变显示状态--%>
	function changeShowState(){
		var dataSet = {
			"pageSize":$("#pageSize").val(),
			"order":$("#order").val(),
			"asc":$("#asc").is(":checked"),
			
			"showLogo":$("#showLogo").is(":checked"),
			"showName":$("#showName").is(":checked"),
			
			"showBaikeInfo":$("#showBaikeInfo").is(":checked"),
			"showBaike":$("#showBaike").is(":checked"),
			"showArea":$("#showArea").is(":checked"),
			"showType":$("#showType").is(":checked"),
			"showTypeCount":$("#showTypeCount").is(":checked"),
			
			"showDirectorInfo":$("#showDirectorInfo").is(":checked"),
			"showDirector":$("#showDirector").is(":checked"),
			"showActor":$("#showActor").is(":checked"),
			"showActorCount":$("#showActorCount").is(":checked"),
			
			"showSummaryInfo":$("#showSummaryInfo").is(":checked"),
			"showSummary":$("#showSummary").is(":checked"),
			"showReleaseDate":$("#showReleaseDate").is(":checked"),
			
			"showSourceInfo":$("#showSourceInfo").is(":checked"),
			"showSource":$("#showSource").is(":checked"),
			"showSourceCount":$("#showSourceCount").is(":checked"),
			
			"showWeight":$("#showWeight").is(":checked"),
			"showCreateTime":$("#showCreateTime").is(":checked"),
			"showUpdateTime":$("#showUpdateTime").is(":checked")
		};
		
		tool.ajax({
			requestUrl:"/admin/ajax?action=movieListUpdateShowCol",
			overtimeUrl:"/admin/login",
			dataSet:dataSet,
			success:function(msg){
				if(msg.stateCode == "success"){
					window.location.reload();
				}
			}
		});
	}
	
	<%--点击编辑--%>
	function clickEdit(){
		$("#state").val("edit");
		$("#searchForm").submit();
	}
	
	<%--点击保存--%>
	function clickSave(){
		var pageSize = 	parseInt($("#pageSize").val());
		var dataSet = {};
		var dataSetNum = 0;
		for(var i = 0 ; i < pageSize ; i++){
			var id = $("#id_" + i).val();
			var name = $("#name_" + i).val();
			var byname = $("#byname_" + i).val();
			var tempImgName = $("#tempImgName_" + i).val();
			var baikeUrl = $("#baikeUrl_" + i).val();
			var area = $("#area_" + i).val();
			var director = $("#director_" + i).val();
			var summary = $("#summary_" + i).val();
			var releaseDate = $("#releaseDate_" + i).val();
			var weight = $("#weight_" + i).val();
			
			var typeCount = parseInt($("#typeCount_" + i).val());
			var actorCount = parseInt($("#actorCount_" + i).val());
			var sourceCount = parseInt($("#sourceCount_" + i).val());
			
			dataSet["id_"+i] = id;
			dataSet["name_"+i] = name;
			dataSet["byname_"+i] = byname;
			dataSet["tempImgName_"+i] = tempImgName;
			dataSet["baikeUrl_"+i] = baikeUrl;
			dataSet["area_"+i] = area;
			dataSet["director_"+i] = director;
			dataSet["summary_"+i] = summary;
			dataSet["releaseDate_"+i] = releaseDate;
			dataSet["weight_"+i] = weight;
			
			dataSet["typeCount_"+i] = typeCount;
			dataSet["actorCount_"+i] = actorCount;
			dataSet["sourceCount_"+i] = sourceCount;
			
			<%--设置类型列表--%>
			for(var j = 0 ; j < typeCount ; j++){
				var movieTypeId = $("#movieTypeId_"+i+"_"+j).val();
				var typeId = $("#typeId_"+i+"_"+j).val();
				var typeWeight = $("#typeWeight_"+i+"_"+j).val();
				
				dataSet["movieTypeId_"+i+"_"+j] = movieTypeId;
				dataSet["typeId_"+i+"_"+j] = typeId;
				dataSet["typeWeight_"+i+"_"+j] = typeWeight;
			}
			
			<%--设置演员列表--%>
			for(var j = 0 ; j < actorCount ; j++){
				var movieActorId = $("#movieActorId_"+i+"_"+j).val();
				var actorName = $("#actorName_"+i+"_"+j).val();
				var roleName = $("#roleName_"+i+"_"+j).val();
				var roleWeight = $("#roleWeight_"+i+"_"+j).val();
				
				dataSet["movieActorId_"+i+"_"+j] = movieActorId;
				dataSet["actorName_"+i+"_"+j] = actorName;
				dataSet["roleName_"+i+"_"+j] = roleName;
				dataSet["roleWeight_"+i+"_"+j] = roleWeight;
			}
			
			<%--设置资源列表--%>
			for(var j = 0 ; j < sourceCount ; j++){
				var movieSourceId = $("#movieSourceId_"+i+"_"+j).val();
				var sourceTypeId = $("#sourceTypeId_"+i+"_"+j).val();
				var sourceLanguageId = $("#sourceLanguageId_"+i+"_"+j).val();
				var sourceSubtitleId = $("#sourceSubtitleId_"+i+"_"+j).val();
				var sourceModeId = $("#sourceModeId_"+i+"_"+j).val();
				var sourceUrl = $("#sourceUrl_"+i+"_"+j).val();
				var sourceWeight = $("#sourceWeight_"+i+"_"+j).val();
				
				dataSet["movieSourceId_"+i+"_"+j] = movieSourceId;
				dataSet["sourceTypeId_"+i+"_"+j] = sourceTypeId;
				dataSet["sourceLanguageId_"+i+"_"+j] = sourceLanguageId;
				dataSet["sourceSubtitleId_"+i+"_"+j] = sourceSubtitleId;
				dataSet["sourceModeId_"+i+"_"+j] = sourceModeId;
				dataSet["sourceUrl_"+i+"_"+j] = sourceUrl;
				dataSet["sourceWeight_"+i+"_"+j] = sourceWeight;
			}
		}
		
		tool.ajax({
			requestUrl:"/admin/ajax?action=movieListSave",
			overtimeUrl:"/admin/login",
			dataSet:dataSet,
			success:function(msg){
				<%--演员名已存在--%>
				if(msg.stateCode == "name_exist"){
					alert("电影名\""+msg.name+"\"已存在");
				}
				<%--地区名不存在--%>
				else if(msg.stateCode == "area_not_exist"){
					alert("地区名\""+msg.area+"\"不存在");
				}
				<%--上映时间格式错误--%>
				else if(msg.stateCode == "releaseDate_format_error"){
					alert("上映时间\""+msg.releaseDate+"\"格式错误");
				}
				<%--成功--%>
				else if(msg.stateCode == "success"){
					<%--调用取消编辑刷新页面--%>
					clickCancelEdit();
				}
			}
		});
	}
	
	<%--点击取消编辑--%>
	function clickCancelEdit(){
		$("#state").val("");
		$("#searchForm").submit();
	}
	
	<%--改变Logo路径事件--%>
	function changeLogoPath(no){
		tool.fileUpload({
			requestUrl:"/admin/ajax?action=uploadImg",
			overtimeUrl:"/admin/login",
			fileId:"logoFile_"+no,
			success:function(msg){
				if(msg.stateCode == "success"){
					$("#logoImg_"+no).attr("src","/image/temp/"+msg.tempImgName);
					$("#tempImgName_"+no).val(msg.tempImgName);
				}
				else if(msg.stateCode == "not_upload"){
					alert("没有上传海报");
				}
				else if(msg.stateCode == "error"){
					alert("上传错误,可能是格式错误");
				}
			}
		});
	}
	
	<%--点击添加电影类型--%>
	function clickAddMovieType(no){
		var movieId = $("#id_"+no).val();
		var typeId = $("#addTypeId_"+no).val();
		var weight = $("#addTypeWeight_"+no).val();
		var dataSet = {
			"movieId":movieId,
			"typeId":typeId,
			"weight":weight
		};
		
		tool.ajax({
			requestUrl:"/admin/ajax?action=movieListAddMovieType",
			overtimeUrl:"/admin/login",
			dataSet:dataSet,
			success:function(msg){
				<%--成功--%>
				if(msg.stateCode == "success"){
					$("#searchForm").submit();
				}
			}
		});
	}
	
	<%--点击添加电影演员--%>
	function clickAddMovieActor(no){
		var movieId = $("#id_"+no).val();
		var actorName = $("#addActorName_"+no).val();
		var roleName = $("#addRoleName_"+no).val();
		var weight = $("#addRoleWeight_"+no).val();
		var dataSet = {
			"movieId":movieId,
			"actorName":actorName,
			"roleName":roleName,
			"weight":weight
		};
		
		tool.ajax({
			requestUrl:"/admin/ajax?action=movieListAddMovieActor",
			overtimeUrl:"/admin/login",
			dataSet:dataSet,
			success:function(msg){
				<%--成功--%>
				if(msg.stateCode == "success"){
					$("#searchForm").submit();
				}
			}
		});
	}
	
	<%--点击添加电影资源--%>
	function clickAddMovieSource(no){
		var movieId = $("#id_"+no).val();
		var typeId = $("#addSourceTypeId_"+no).val();
		var languageId = $("#addSourceLanguageId_"+no).val();
		var subtitleId = $("#addSourceSubtitleId_"+no).val();
		var modeId = $("#addSourceModeId_"+no).val();
		var url = $("#addSourceUrl_"+no).val();
		var weight = $("#addSourceWeight_"+no).val();
		
		var dataSet = {
			"movieId":movieId,
			"typeId":typeId,
			"languageId":languageId,
			"subtitleId":subtitleId,
			"modeId":modeId,
			"url":url,
			"weight":weight
		};
		
		tool.ajax({
			requestUrl:"/admin/ajax?action=movieListAddMovieSource",
			overtimeUrl:"/admin/login",
			dataSet:dataSet,
			success:function(msg){
				<%--成功--%>
				if(msg.stateCode == "success"){
					$("#searchForm").submit();
				}
			}
		});
	}
	
	<%--改变资源 类型ID事件--%>
	function changeSourceTypeId(no1,no2){
		<%--获得新的资源类型ID--%>
		var sourceTypeId = $("#sourceTypeId_"+no1+"_"+no2).val();
		
		<%--获得对应的数据--%>
		var sourceTypeLogoPositionY = $("#sourceTypeLogoPositionY_"+sourceTypeId).val();
		var sourceTypeAdDuration = $("#sourceTypeAdDuration_"+sourceTypeId).val();
		
		<%--设置数据--%>
		$("#sourceTypeLogo_"+no1+"_"+no2).css("background-position","0px " + sourceTypeLogoPositionY);
		$("#sourceTypeAdDuration_"+no1+"_"+no2).html(sourceTypeAdDuration);
	}
	
	<%--改变添加资源 类型ID事件--%>
	function changeAddSourceTypeId(no){
		<%--获得新的资源类型ID--%>
		var sourceTypeId = $("#addSourceTypeId_"+no).val();
		
		<%--获得对应的数据--%>
		var sourceTypeLogoPositionY = $("#sourceTypeLogoPositionY_"+sourceTypeId).val();
		var sourceTypeAdDuration = $("#sourceTypeAdDuration_"+sourceTypeId).val();
		
		<%--设置数据--%>
		$("#addSourceTypeLogo_"+no).css("background-position","0px " + sourceTypeLogoPositionY);
		$("#addSourceTypeAdDuration_"+no).html(sourceTypeAdDuration);
	}
	
	<%--初始化添加资源 类型ID事件--%>
	function iniAddSourceTypeId(){
		var pageSize = 	parseInt($("#pageSize").val());
		for(var i = 0 ; i < pageSize ; i++){
			changeAddSourceTypeId(i);
		}
	}
	
	<%--调用初始化--%>
	iniAddSourceTypeId();
	
	<%--点击全选--%>
	function clickSelectAll(){
		var selectAll = $("#selectAll").is(":checked");
		var pageSize = 	parseInt($("#pageSize").val());
		for(var i = 0 ; i < pageSize ; i++){
			$("#select_"+i).attr("checked",selectAll);
		}
	}
	
	<%--点击删除电影类型--%>
	function clickDeleteMovieType(id){
		if(confirm("确定删除电影类型?")){
			var dataSet = {
				"id":id
			};
			
			tool.ajax({
				requestUrl:"/admin/ajax?action=movieListDeleteMovieType",
				overtimeUrl:"/admin/login",
				dataSet:dataSet,
				success:function(msg){
					<%--成功--%>
					if(msg.stateCode == "success"){
						$("#searchForm").submit();
					}
				}
			});
		}
	}
	
	<%--点击删除电影演员--%>
	function clickDeleteMovieActor(id){
		if(confirm("确定删除电影演员?")){
			var dataSet = {
				"id":id
			};
			
			tool.ajax({
				requestUrl:"/admin/ajax?action=movieListDeleteMovieActor",
				overtimeUrl:"/admin/login",
				dataSet:dataSet,
				success:function(msg){
					<%--成功--%>
					if(msg.stateCode == "success"){
						$("#searchForm").submit();
					}
				}
			});
		}
	}
	
	<%--点击删除电影资源--%>
	function clickDeleteMovieSource(id){
		if(confirm("确定删除电影资源?")){
			var dataSet = {
				"id":id
			};
			
			tool.ajax({
				requestUrl:"/admin/ajax?action=movieListDeleteMovieSource",
				overtimeUrl:"/admin/login",
				dataSet:dataSet,
				success:function(msg){
					<%--成功--%>
					if(msg.stateCode == "success"){
						$("#searchForm").submit();
					}
				}
			});
		}
	}
	
	<%--点击删除选中电影--%>
	function clickDeleteSelectMovie(){
		var pageSize = 	parseInt($("#pageSize").val());
		var dataSet = {};
		var dataCount = 0;
		for(var i = 0 ; i < pageSize ; i++){
			<%--获得选中行的 演员ID--%>
			var select = $("#select_"+i).is(":checked");
			if(select){
				var id = $("#id_" + i).val();
				dataSet["id_"+dataCount] = id;
				dataCount++;
			}
		}
		if(dataCount!=0 && confirm("确定删除选中电影?")){
			dataSet["count"] = dataCount;
			tool.ajax({
				requestUrl:"/admin/ajax?action=movieListDeleteMovie",
				overtimeUrl:"/admin/login",
				dataSet:dataSet,
				success:function(msg){
					<%--成功--%>
					if(msg.stateCode == "success"){
						$("#searchForm").submit();
					}
				}
			});
		}
	}
	
	<%--点击删除电影--%>
	function clickDeleteMovie(id){
		if(confirm("确定删除电影?")){
			var dataSet = {
				"id_0":id,
				"count":1
			};
			tool.ajax({
				requestUrl:"/admin/ajax?action=movieListDeleteMovie",
				overtimeUrl:"/admin/login",
				dataSet:dataSet,
				success:function(msg){
					<%--成功--%>
					if(msg.stateCode == "success"){
						$("#searchForm").submit();
					}
				}
			});
		}
	}
</script>
</html>
